package com.gitee.aurora.server.controller;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.gitee.aurora.core.utils.ResultVO;
import com.gitee.aurora.server.service.DataCheckService;
import com.gitee.aurora.server.vo.DataCheckVo;
import com.gitee.aurora.server.vo.ResultCheckVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * author: jiangfuxiao
 * Date:2022/9/2 9:28
 */
@Controller
@ResponseBody
@RequestMapping("dataCheck")
@Api(value = "数据检测接口", tags = {"数据检测接口类"})
public class DataCheckController {


    @Resource(name = "dataCheckServiceImpl")
    private DataCheckService dataCheckService;

    /**
     * 市级数据中心办案区接口
     */
    @PostMapping("/checkBaq")
    @ApiOperation(value = "检测办案区接口", notes = "检测办案区接口")
    public ResultVO checkBaq(@RequestBody DataCheckVo checkVo) {
        return  dataCheckService.checkBaq(checkVo);
    }

    /**
     *省数据中心检测下级数据接口。
     */
    @PostMapping("/checksszx")
    @ApiOperation(value = "省数据中心检测下级数据接口", notes = "省数据中心检测下级数据接口")
    public ResultVO checksszx(@RequestBody DataCheckVo checkVo) {
        return  dataCheckService.checksszx(checkVo);
    }


    @PostMapping("/queryListPage")
    @ApiOperation(value = "分页查询检测缺失数据", notes = "分页查询检测缺失数据")
    public ResultVO queryListPage(@RequestBody DataCheckVo checkVo) throws JsonProcessingException {
        return  dataCheckService.queryListPage(checkVo);
    }


    @PostMapping("/insertData")
    @ApiOperation(value = "数据同步接口", notes = "数据同步接口")
    public ResultVO insertData(@RequestBody DataCheckVo checkVo) {
        return  dataCheckService.insertData(checkVo);
    }

    @PostMapping("/insertSjzxData")
    @ApiOperation(value = "省数据数据中心同步接口", notes = "省数据数据中心同步接口")
    public ResultVO insertSjzxData(@RequestBody ResultCheckVo resultCheckVo) throws JsonProcessingException {
        return  dataCheckService.insertSjzxData(resultCheckVo);
    }
}
